package com.mytest.controller;

import com.mytest.jwtentity.JWTResponseData;
import com.mytest.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Wulc
 * @date 2024/4/8 10:50
 * @description
 */
@RestController
@RequestMapping("/jwt")
public class LoginController {
    @Autowired
    private LoginService loginService;

    @GetMapping("/login")
    @ResponseBody
    public JWTResponseData login(@RequestParam("username") String username, @RequestParam("password") String password) {
        return loginService.login(username, password);
    }

    @GetMapping("/loginout")
    @ResponseBody
    public JWTResponseData loginout(@RequestParam("username") String username) {
        return loginService.loginout(username);
    }
}
